#define LCDbus	PORTB
#define RS		RA4
#define AdrBit1 RC0
#define AdrBit2 RA2
#define AdrBit3 RA3

#define DSPCLR	0x01
#define	CRHOME	0x02
#define ENTMOD	0x06
#define DSPON	0x0C
#define DSPOFF  0x08
#define	CSHIFT	0x14 //shift cursor right
#define	FUNCSET	0x38
#define	DSP_CURSOR	0x0e

//defines
#define INPUT 1		//port directions
#define OUTPUT 0
#define TRUE 1
#define FALSE 0

//#define LCDadr	0x00
#define AdrEnable 	RC5

// Basic LCD Functions
extern void LCDInit(void);
extern void SwitchOffDisplay(void); 
extern void WriteLCDCtrl(unsigned char b);
extern void WriteLCDData(unsigned char c);
extern void LCDCursor(unsigned char r, unsigned char c);
//extern void Write_Hex(char b);
//extern void Write_Dec(char b);

// Writes data
extern void WriteSpeed(unsigned int speed);
extern void WriteAvgSpeed(unsigned int speed);
extern void WriteDistTime(unsigned long binary);
extern void updateSettingsData(unsigned int wheelCircumference);
extern void updateSettingsData2(unsigned char inWeight);


extern void setSettingsCursor(unsigned char digit);
extern void setSettingsCursor2(unsigned char digit);
//extern void enterSettings();
//extern void leaveSettings();

// Writes explanations
extern void WriteKPH();
extern void WriteSettings();
extern void WriteSettings2();
extern void WriteSet1(char type);
extern void WriteSet2(char type);
extern void WriteSleep();
extern void WriteReset();
extern void WritePower();
extern void WriteEnergy();

// Macros
#define enterSettings() { \
	WriteLCDCtrl(DSP_CURSOR); \
}
#define leaveSettings() { \
	WriteLCDCtrl(DSPON); \
}
